<?php
/*
# ------------------------------------------------------------------------
# JA Job Board Package
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com.
# ------------------------------------------------------------------------
*/
  defined('_JEXEC') or die('Retricted Access');
  $lists = $this->lists;
  JHTML::_('behavior.tooltip');
?>


<form name="adminForm" action="index.php" method="post">
	
    <div style="width:100%;">
		<table width="100%">
        <tr>
       
        <td valign="top">
        	<?php echo $this->menu_User();?>
        	<br/>
       
			<table class="adminlist">
	        	<thead>
					<tr>
						<th width="20">
							<?php echo JText::_( 'NUM' ); ?>
						</th>
						 <th width="20">
							<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($this->items); ?>);" />
						</th> 
						<th>            		
	            			<?php echo JHTML::_('grid.sort',   JText::_('FEED NAME'), 'u.FeedName',@$lists['filter_order_Dir'], @$lists['filter_order'] ); ?>
	            		</th>
						<th>            		
	            			<?php echo JText::_('Status'); ?>
	            		</th> 
						<th>            		
	            			<?php echo JHTML::_('grid.sort',   JText::_('PICKUP METHOD'), 'u.Method',@$lists['filter_order_Dir'], @$lists['filter_order'] ); ?>
	            		</th> 
	            			            						
					</tr>
				</thead>
				<tbody>
	        	<?php
	        	$items = $this->items;
	        	
	        	for($i = 0, $n = count($items); $i < $n; $i++){
	        		$item = $items[$i];
	        		$item->checked_out = 0;
					$checked = JHTML::_('grid.checkedout',   $item, $i, "FeedID" );
	        		?>
	        		<tr class="row<?php echo $i%2; ?>">
	            		<td align="center"><?php echo $this->pagination->getRowOffset( $i );  ?></td>            		
	            		 <td align="center"><?php echo $checked; ?></td> 
	            		<td>
	            			<a href="<?php echo 'index.php?option='. $this->lists['option'] .'&view=jaxmlimport&tab=feeds&task=edit&cid[]='.$item->FeedID ; ?>">
	            				<?php echo $item->FeedName; ?>
	            			</a>
	            		</td>
	            		<td align="left">
	            <?php 
	            
	            $feedrow = JAJobBoardModelJAXMLImport::fcnLoadFeedRowDatas($item->FeedID);
	            
	            $recordStatus = JAJobBoardModelJAXMLImport::fcnUpdateXMLImportStatus($feedrow);
	            
	            if ($recordStatus == 'DONE') {
					echo JText::_("STEP 1: DECLARE XML SOURCE")." <font color='green'>[".JText::_("DONE")."]</font> <a href='index.php?option=". $this->lists['option'] ."&view=jaxmlimport&tab=feeds&task=edit&cid[]=".($item->FeedID)."' >[".JText::_("EDIT")."]</a> <br/>";
					echo JText::_("STEP 2: SETUP FEED STRUCTURE")." <font color='green'>[".JText::_("DONE")."]</font> <a href='index.php?option=". $this->lists['option'] ."&view=jaxmlimport&tab=feeds&task=setupstruct&cid[]=".($item->FeedID)."' >[".JText::_("EDIT")."]</a> <br/>";
					echo JText::_("STEP 3: MAP FIELDS").' <font color="green">['.JText::_("DONE").']</font> <a href="index.php?option='. $this->lists['option'] .'&view=jaxmlimport&tab=feeds&task=setupfield&cid[]='.($item->FeedID).'">['.JText::_("EDIT").']</a><br/>';
					echo JText::_("STEP 4: IMPORT DATA").' <font color="green">['.JText::_("DONE").']</font> <a href="index.php?option='. $this->lists['option'] .'&view=jaxmlimport&tab=feeds&task=importdata&cid[]='.($item->FeedID).'" onclick="if (!confirm(\'You have imported data by this feed, do you want to import data again?\')) return false;" >['.JText::_("REDO").']</a><br/>';
				}
	            
				if ($recordStatus == 'READY') {
					echo JText::_("STEP 1: DECLARE XML SOURCE")." <font color='green'>[".JText::_("DONE")."]</font> <a href='index.php?option=". $this->lists['option'] ."&view=jaxmlimport&tab=feeds&task=edit&cid[]=".($item->FeedID)."' >[".JText::_("EDIT")."]</a> <br/>";
					echo JText::_("STEP 2: SETUP FEED STRUCTURE")." <font color='green'>[".JText::_("DONE")."]</font> <a href='index.php?option=". $this->lists['option'] ."&view=jaxmlimport&tab=feeds&task=setupstruct&cid[]=".($item->FeedID)."' >[".JText::_("EDIT")."]</a> <br/>";
					echo JText::_("STEP 3: MAP FIELDS").' <font color="green">['.JText::_("DONE").']</font> <a href="index.php?option='. $this->lists['option'] .'&view=jaxmlimport&tab=feeds&task=setupfield&cid[]='.($item->FeedID).'">['.JText::_("EDIT").']</a><br/>';
					echo '<font color="green"><b><a href="index.php?option='. $this->lists['option'] .'&view=jaxmlimport&tab=feeds&task=importdata&cid[]='.($item->FeedID).'" onclick="if (!confirm(\'System will import job data, are you sure?\')) return false;" >'.JText::_("FINAL: READY TO IMPORT").'</a></b></font>';
				}
				
				if ($recordStatus == 'NEW_SAMPLE') {
					echo JText::_("STEP 1: DECLARE XML SOURCE")." <font color='green'>[".JText::_("DONE")."]</font> <a href='index.php?option=". $this->lists['option'] ."&view=jaxmlimport&tab=feeds&task=edit&cid[]=".($item->FeedID)."' >[".JText::_("EDIT")."]</a><br/>";
					echo '<a href="index.php?option='. $this->lists['option'] .'&view=jaxmlimport&tab=feeds&task=setupstruct&cid[]='.($item->FeedID).'" style="color:green; font-weight: bold;">'.JText::_("STEP 2: PLEASE SETUP FEED STRUCTURE").'</a>';
				}
				
				if ($recordStatus == 'SET_FIELDS') {
					echo JText::_("STEP 1: DECLARE XML SOURCE")." <font color='green'>[".JText::_("DONE")."]</font> <a href='index.php?option=". $this->lists['option'] ."&view=jaxmlimport&tab=feeds&task=edit&cid[]=".($item->FeedID)."' >[".JText::_("EDIT")."]</a> <br/>";
					echo JText::_("STEP 2: SETUP FEED STRUCTURE")." <font color='green'>[".JText::_("DONE")."]</font> <a href='index.php?option=". $this->lists['option'] ."&view=jaxmlimport&tab=feeds&task=setupstruct&cid[]=".($item->FeedID)."'>[".JText::_("EDIT")."]</a> <br/>";
					echo '<a href="index.php?option='. $this->lists['option'] .'&view=jaxmlimport&tab=feeds&task=setupfield&cid[]='.($item->FeedID).'" style="color:green; font-weight: bold;">'.JText::_("STEP3: PLEASE MAP YOUR FIELDS").'</a>';
				}
				?>
	            		</td>
	            		<td><?php echo $item->Method; ?></td>  
	            		             
	            	</tr>
	        	<?php	        		
				}
	        	?>
	        	<tbody>
	        	<tfoot>
					<tr>
						<td colspan="8">
							<?php echo $this->pagination->getListFooter(); ?>
						</td>
					</tr>
				</tfoot>
			</table>
        </td>
        </tr>
        </table>
	</div>
	<input type="hidden" name="option" value="<?php echo $this->lists['option']; ?>" />
	<input type="hidden" name="view" value="jaxmlimport" />
    <input type="hidden" name="task" value="list" />
    <input type="hidden" name="tab" value="feeds" />
    <input type="hidden" name="boxchecked" value="0" />
	<input type="hidden" name="filter_order" value="<?php echo $this->lists['filter_order']; ?>" />
	<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['filter_order_Dir']; ?>" />
	<?php echo JHTML::_( 'form.token' ); ?>
 </form>
